<template>
    <div>
        语文成绩：<input type="text" v-model="project_zw"><br>
        数学成绩：<input type="text" v-model="project_sx"><br>
        英语成绩：<input type="text" v-model="project_en"><br>
        总成绩：{{fullScore}}分
        平均成绩：{{avgScore}}分
    </div>
</template>

<script>
    export default {
        data() {
            return {
                project_zw: 60,
                project_sx:60,
                project_en:60,
                avgScore:0
            }
        },
        computed: {
            fullScore() {
                return Number(this.project_zw)+Number(this.project_sx)+Number(this.project_en); 
            }
        },
        watch:{
            fullScore:{
                handler(newValue){
                    this.avgScore = newValue/3;
                },
                immediate:true
            }
        }
    }
</script>

<style lang="scss" scoped>

</style>